Skip to content

feat(pm-agg): forecast input for quota admission — Stage-3 S4 (#12698) - #13271

Merged
dezren39 merged 1 commit into
mainfrom
lane-ur-12698
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-ur-12698

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Stage-3 S4 implementation slice for #12698, per design decision D4 (doc/2026-11-22T22-35-00Z_design_quota-plane-stage-3): the existing quota-admission verdict path now takes the S1 forecast as an input. This is the implementation landing only — nothing is enabled; the go-live stays gated on S3's shadow week (see the progress note on #12698).

  • src/quota-admission.ts — AdmissionInput gains optional forecasts rows, supplied per exact billing scope exactly like observations (the fleet(pools): enforce monthly pace guards at seating time — steward hard stops are currently advisory and were burned through (cline-pass + both Go monthlies walled) #2732 scope discipline is unchanged; display pool identity is still not accepted). A binding window opts in per-window via a new forecastMarginMs policy field. The rule, applied only to an otherwise eligible window: the latest forecast row for the window — internally consistent, projected from the window's current reading, still fresh by the same bound the measured path applies to observations — with state projected, wallsBeforeReset, and a projected wall at least the configured margin before the reset yields pace_hold with reason forecast_projected_wall and the forecast row as evidence. A stale, superseded, conflicting, or honesty-state forecast is exactly current behaviour (impl(quota-plane): stage-3 S4 — live forecast-driven admission: pace_hold from projected exhaustion #12698 criterion 3, pinned by tests). The forecast never overrides a measured verdict and never manufactures evidence for an unknown window.
  • src/quota-admission-forecast-config.ts — the D4 flag in the PM_AGG_STORE_BACKEND posture: PM_AGG_FORECAST_ADMISSION defaults to off (today's behaviour); on requires PM_AGG_FORECAST_ADMISSION_POOL (the one named pool) and PM_AGG_FORECAST_ADMISSION_MARGIN_MS (positive integer); invalid values throw. Flipping the flag back is the whole rollback.
  • Designated first pool when the go-live gate clears: opendesign — S2's backtest (impl(quota-plane): stage-3 S2 — forecast accuracy ledger + backtest harness over the snapshot history #12696) scored it precision 0.965 over 327 scored forecasts / 28 periods (16 walled), the strongest precision at volume. Pool and margin are configuration set from that calibration, changed once live only via the design's proposal mechanism (D5).

Evidence

  • Failing-first: the new admission tests failed behaviourally on origin/main (4 failures: the D4 hold, the exact-margin hold, duplicate-row hold, invalid-margin policy) before the change.
  • New tests: 19 pass (14 in test/quota-admission-forecast.test.ts, oracle = design D4 + criterion 3; 5 in test/quota-admission-forecast-config.test.ts, oracle = D4 flag posture).
  • Neighbours: quota-admission, quota-admission-source, quota-admission-shadow suites all pass; the no-forecast projection is byte-identical to the pre-S4 output (pinned by test). tsc --noEmit and biome clean on all touched files.
  • Full aggregator suite on the laptop at the PR head: 3152 pass / 16 fail. The 16 are environmental, not this change: 14 are server-boot failures (the live aggregator holds port 4871) proven identical on pristine origin/main in the same environment — the failing-file subset re-ran 1 pass / 14 fail on both trees — and 2 are load-timeout flakes in files that do not import the changed module. No failing file imports quota-admission.
  • Ran on the laptop at 9fa5ba86804. Remote dispatch attempted first (run 45176376837) failed at the Execute-target-command step — the fleet-build container toolchain gap (fleet: fleet-command dispatch container cannot run nix develop out of the box (experimental features, nixbld group, homeless-shelter purity) #13159 family), an environment failure, not a test result; the laptop run is the verifying route.

Merge danger

Default-off and additive: with no forecasts input or no forecastMarginMs policy, buildQuotaAdmission output is unchanged. The only new verdict path requires both caller-supplied forecast rows and per-window margin policy. Rollback is config alone (stop supplying either), or revert.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T12:44:34Z",
    "session_id": null,
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/wt-lane-ur-12698",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/wt-lane-ur-12698",
      "repo": "developing-today/code",
      "branch": "lane-ur-12698",
      "sha": "9fa5ba868046abc0088ebe00a8f64a750cd0616d"
    },
    "auth_subject": "code-g",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

#12698

Design D4: buildQuotaAdmission gains an optional forecasts input,
supplied per exact billing scope like observations. A window opts in
via forecastMarginMs; a fresh forecast projected from the window's
current reading (state projected, wallsBeforeReset, wall at least the
margin before reset) adds pace_hold to an otherwise eligible window.
Stale, superseded, conflicting or honesty-state forecasts are exactly
current behaviour (criterion 3). No forecast input = byte-identical
projection.

Plus the D4 flag in PM_AGG_STORE_BACKEND posture
(quota-admission-forecast-config.ts): PM_AGG_FORECAST_ADMISSION off by
default; on requires the one named pool and a positive margin; invalid
values throw. Flipping back is the whole rollback. Nothing is enabled
by this change; go-live stays gated on S3's shadow week.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T12:46:01.508894Z 9fa5ba8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 3d73cbb into main Nov 23, 2026
1 check passed
@dezren39
dezren39 deleted the lane-ur-12698 branch November 23, 2026 12:44
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant